import { View } from "../../../mvc/core/View";
import { GTextFormat } from "../../../common/GTextFormat";
import { DataProvider } from "../../../../fl/data/DataProvider";
import { ObjCreate } from "../common/ObjCreate";
import { ImagesConst } from "../../resource/ImagesConst";
import { Language } from "../../../../extend/language/Language";
import { TilePanel } from "../equipment/TilePanel";
import { TreasureProfileRenderer } from "../treasure/TreasureProfileRenderer";
import { TreasureOverViewNewSp } from "../treasure/TreasureOverViewNewSp";
//class ChristmasTreeGetPanel
    
    export  class ChristmasTreeGetPanel extends View
    {
        constructor()
        {
            super();
            this._dataArray = [];
            this._tileTf = new GTextFormat("", 15, 15788607);
            this._getDp = new DataProvider();
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            ObjCreate.createBg(0, 0, 198, 433, this);
            ObjCreate.createBg(0, 0, 198, 25, this, ImagesConst.TileBg);
            this._getTitleTxt = ObjCreate.createGTextField(Language.getString(55006), 0, 5, 195, 25, this, this._tileTf);
            this._getTitleTxt.autoSize = flash.text.TextFieldAutoSize.CENTER;
            this._getListPanel = new TilePanel();
            this._getListPanel.setStyle("cellRenderer", TreasureProfileRenderer);
            this._getListPanel.columnWidth = 180;
            this._getListPanel.rowHeight = 20;
            this._getListPanel.setSize(180, 170);
            this._getListPanel.move(10, 30);
            this.addChild(this._getListPanel);
            ObjCreate.createBg(0, 200, 198, 25, this, ImagesConst.TileBg);
            this._bcTitleTxt = ObjCreate.createGTextField(Language.getString(55007), 0, 205, 195, 25, this, this._tileTf);
            this._bcTitleTxt.autoSize = flash.text.TextFieldAutoSize.CENTER;
            this._severSp = new TreasureOverViewNewSp(195, 205);
            this._severSp.y = 225;
            addChild(this._severSp);
            return;
        }

        public addGetItemToPanel(arg1: Object): void
        {
            this._getListPanel.dataProvider.addItem(arg1);
            this._getListPanel.drawNow();
            this._getListPanel.verticalScrollPosition = this._getListPanel.maxVerticalScrollPosition;
            return;
        }

        public updateGetPanel(arg1: Array<any>): void
        {
            this._getDp.removeAll();
            var loc1=0;
            while (loc1 < arg1.length) 
            {
                this._getDp.addItem(arg1[loc1]);
                ++loc1;
            }
            this._getListPanel.dataProvider = this._getDp;
            this._getListPanel.drawNow();
            this._getListPanel.verticalScrollPosition = this._getListPanel.maxVerticalScrollPosition;
            return;
        }

        public updateRecordsPanel(arg1: Array<any>): void
        {
            this._dataArray = arg1;
            this._severSp.update(this._dataArray);
            this._severSp.maxScrollPosition();
            return;
        }

        public addRecordToPanel(arg1: Object): void
        {
            this._dataArray.push(arg1);
            this._severSp.update(this._dataArray);
            this._severSp.maxScrollPosition();
            return;
        }

        /* internal */ /* var */_getTitleTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_bcTitleTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_getListPanel: TilePanel;

        /* internal */ /* var */_severSp: TreasureOverViewNewSp;

        /* internal */ /* var */_dataArray: Array<any>;

        /* internal */ /* var */_tileTf: Object /* flash.text.TextFormat */;

        /* internal */ /* var */_getDp: DataProvider;
    }
